<template>
	<view class="content">
		<view>
			<scroll-view scroll-x class="bg nav text-white">
				<view class="cu-item flex-sub" style="font-size: 18px;">猜你想问</view>
			</scroll-view>
			<scroll-view scroll-x class="bg nav text-white">
				<view class="flex justify-between margin-bottom bg padding-sm" v-for="(item,index) in tabData"
					:key="index" @tap="goNav(item)">
					{{item.name}}
				</view>
			</scroll-view>
		</view>
	</view>
</template>
<script>
	export default {
		onShow() {
			let self = this;
			uni.request({
					url: 'http://localhost:8080/getAllCate',
					success(res) {
						console.log(res.data.data);
						self.tabData = res.data.data
					}
				})
				// this.$myRequest({
				// 	url: "/queslist",
				// 	method: "POST"
				// }).then(r => {
				// 	self.tabData = r.data.data;
				// 	console.log(this.quseData);
				// })
				// uni.request({
				// 	url: 'http://localhost:8080/getAllQuesName',
				// 	success(res) {
				// 		self.quseData = res.data.data
				// 	}
				// })
		},
		data() {
			return {
				keyword: '',
				TabCur: 0,
				tabData: [],
				quseData: [],
				randomGoods: [],
				scrollLeft: 0,
				swiperList: [{
						image: 'https://cdn.uviewui.com/uview/swiper/1.jpg',
						title: '昨夜星辰昨夜风，画楼西畔桂堂东'
					},
					{
						image: 'https://cdn.uviewui.com/uview/swiper/2.jpg',
						title: '身无彩凤双飞翼，心有灵犀一点通'
					},
					{
						image: 'https://cdn.uviewui.com/uview/swiper/3.jpg',
						title: '谁念西风独自凉，萧萧黄叶闭疏窗，沉思往事立残阳'
					}
				],
				src: '../../static/images/index/image_dijia1.png',
				value1: 1,
				value2: 1,
				value3: 1,
			}
		},
		onLoad() {},
		methods: {
			tabSelect(e) {
				this.TabCur = e.currentTarget.dataset.id;
				this.scrollLeft = (e.currentTarget.dataset.id - 1) * 60
			},
			// 跳转问答列表
			goNav(e) {
				console.log("类型id：", e.id);
				uni.navigateTo({
					url: '/my/help/quesList?id=' + e.id
				})
			},
			goList(e) {
				console.log("问题id：", e.id);
				uni.navigateTo({
					url: '/my/help/quesAndAnswer?id=' + e.id
				})
			}
		}
	}
</script>

<style>
	page {
		background-color: #111224;
	}

	.bg {
		background-color: #1E1F31;
	}
</style>
